<?php
class BannersBig extends CActiveRecord {
    
    public $id;
    public $emptyCode;
    public $bannerCode;
    public $type;
    
    public static function model($className = __CLASS__) {
        return parent::model($className);
    }
    
    public function beforeValidate() {
        if(!parent::beforeValidate()) return false;
        $this->attributes = !empty($_POST[get_class($this)]) ? $_POST[get_class($this)] : array();
        return true;
    }
    
    public function rules() {
        return array(
            array('type', 'unique'),
            array('bannerCode, emptyCode', 'required')
        );
    }

    public function tableName() {
        return 'banners_big';
    }
    
    public function attributeLabels() {
        return array(
            'type'=>'Тип',
            'bannerCode'=>'Код',
            'emptyCode'=>'Код заглушки'
        );
    }
}
